// pages/My/My.js
var url = wx.getStorageSync('url')
var shopid = wx.getStorageSync('shopid')
var userId = wx.getStorageSync('userId')
var openid = wx.getStorageSync('openid')
var time_ss = wx.getStorageSync('time_ss')
Page({

  /**
   * 页面的初始数据
   */
  data: {
      list_1:[{
        message:'我的订单',
        img:'../../img/d_dan.png'
      }, {
          message: '我的好友',
          img: '../../img/h_you.png'
        },
        {
          message: '我的地址',
          img: '../../img/d_zhi.png'
        }, {
          message: '帮助中心',
          img: '../../img/b_zhu.png'
        }, {
          message: '个人中心',
          img: '../../img/d_dan.png'
        },{
          message:'我的收藏',
          img:'../../img/s_zhi.png'
      }]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onShow: function (options) {
    var shopid = wx.getStorageSync('shopid')
    var userId = wx.getStorageSync('userId')
    var openid = wx.getStorageSync('openid')
    var width = wx.getSystemInfoSync().windowWidth/3
    var that = this
    console.log(userId)
    console.log(openid)
    // 
    wx.request({
      url: url +'gateWare/mpUserCenter',
      data: {
        "list": false,
        "nodeId": "kdslfw",
        "platform": 2,
        "privId": "default",
        "resId": "default",
        "sendTime": time_ss,
        "seq": 1,
        "shopId": shopid,
        "source": 11,
        "sysVer": "1.0.0",
        "token": "kdsjfoewi12ijsldks",
        "type": 1,
        "userId": userId,
        "userType": 1,
        "content": {
          "userId": userId,
          "shopId": shopid
        }
      },
      method: "POST",
      header: { "Content-Type": "application/JSON" },
      success: function (e) {
        var data = e.data.content
        console.log(data)
        that.setData({
          banler: data
        })
      }
    })
  },
  go_Recharge:function(){
    wx.navigateTo({
      url: 'Recharge/Recharge'
    })
  },
  
  go_drawing:function(){
    wx.navigateTo({
      url: 'drawing/drawing'
    })
  },
  goto_:function(e){
    var id = e.currentTarget.id
    console.log(id)
    if (id == 2) {
      wx.navigateTo({
        url: 'address/address',
      })
    }
    if (id == 1){
      wx.navigateTo({
      url: 'MyFriend/MyFriend',
    })
    }
    if (id == 3) {
      wx.navigateTo({
        url: 'HelpCenter/HelpCenter',
      })
    }
    if (id == 4) {
      wx.navigateTo({
        url: 'PersonalCenter/PersonalCenter',
      })
    }
    if (id == 5) {
      wx.navigateTo({
        url: 'Collection/Collection',
      })
    }
    if (id == 0) {
      wx.switchTab({
        url: '../Order/Order',
      })
    }
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    
  },

  /**
   * 生命周期函数--监听页面显示
   */
  // onShow: function () {

  // },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})